var TheTableControl;

function initPage(){
	InitTableControl();
}

/**初始化数据列表空间**/
function InitTableControl(){
	TheTableControl=new TableController('TheTableControl');	
	TheTableControl.objTable=document.all.DummyTable;
	TheTableControl.OnAfterRowSelected=afterSelectTheRow;
	if(TheTableControl.Count()>0)
	{
		TheTableControl.SelectARow(0);
	}else{
		initButtonStatus();
	}
}

/**根据选择的数据行的状态动态改变功能菜单的有效性**/
function afterSelectTheRow()
{
//	disableTD(document.all.deleteType);
}

/**初始化数据列表之后显示功能菜单的有效性**/
function initButtonStatus()
{
	if (TheTableControl.Count()<1)
	{   
	//	disableTD(document.all.deleteType);
	}else
	{   
	//	enableTD(document.all.deleteType);		
	}
}

/**===============START:用户事件代码==================**/
/**显示操作的图片库下面的图片**/
function showPhotoList(libIndex){
	window.location.href="./portal/photo/photolist.jsp?libindex=" + libIndex;
}

/*** 新建一个类别 **/
function createType(){	
	PopDivUp(1);
}

/** 删除一个类别 **/
function deleteType(){
	var aid = TheTableControl.getItem(4);	
	if( confirm( "您确实要删除这个类别中所包含的所有图片吗？" ))
	{		
		AjaxAction.syncCall('photoAction.deletePhotoSpecialType',aid);
	//	window.location.href = "MAILBOX.com";	
	}else{
		return;
	}
}
/** 修改一个类别信息 **/
function editType(){
	PopDivUp(2);
}








/**===============END:用户事件代码==================**/
function gotoPage(iPageNo)
{  
	with(document.all)
	{  
		var iPage=parseInt(PageNo.innerHTML);
		iPage=(isNaN(iPageNo))?1:((iPageNo<=0)?((iPageNo<0)?--iPage:++iPage):iPageNo);
		if(iPage<=parseInt(totalPage.innerHTML) && iPage>0)
		{		
		location=location.pathname+"?PageNo=" +iPage + "&OrderField=" + document.getElementById("OrderField").value + "&OrderWise=" + document.getElementById("OrderWise").value;
		}
	}
}


/**当Form被提交时候执行**/
function onTheFormSubmit(){
	return true;
}

function OrderBy(strField)
{
	var oWise,strOrderWise;
	oWise=document.getElementById("OrderWise");

	if (document.getElementById("OrderField").value==strField)
	{
		if (oWise.value=="ASC")
			strOrderWise="DESC";
		else
			strOrderWise="ASC";
	}
	else
		strOrderWise="ASC";

	location=location.pathname+"?OrderField=" + strField + "&OrderWise=" + strOrderWise;

}


var parentDivArgs;
var CurrentOpenned;
function PopDivUp(a,cUrl) {
	var sURL;
	var icenter;
	var idialogWidth;
	var idialogHeight;
	var bShowScrollBar;
	var CnTitle;
	var EnTitle;
	var openMode;	//打开方式
	if(a>0){	
		switch(a) {
			//<新增一个专辑类别>
			case   1: if(cUrl!=null) sURL=cUrl; else sURL="/eaip/portal/photo/newSpecialType.jsp"; openMode=0; idialogWidth="380px"; idialogHeight="280px"; break;
			//<修改一个专辑类别>
			case   2: if(cUrl!=null) sURL=cUrl; else sURL="/eaip/portal/photo/editSpecialType.jsp?aid="+TheTableControl.getItem(4); openMode=0; idialogWidth="380px"; idialogHeight="280px"; break;
	
	
		}
		
		if (document.all) {
			var V6Sorting;
			var strLanguage='';			
			CurrentOpenned = a;
			if (PopDivUp.arguments.length>1){
				strLanguage=PopDivUp.arguments[1];
				sURL = sURL + '&language='+strLanguage;
			}				
			openURL = sURL + getVerString(sURL);							
			switch (openMode){
				case 0:				
					OpenDivDialog(openURL,'',idialogWidth,idialogHeight,"",CnTitle,EnTitle);
					break;
				case 1:
					var leftWidth = (window.screen.width-parseInt(idialogWidth))/2;
					var topHeight = (window.screen.height-parseInt(idialogHeight))/2;
					window.open(openURL,'','resizable=yes,scrollbars=auto,menubar=no,directories=no,toolbar=no,location=no,status=1,center=yes,help=yes,left='+leftWidth+',top='+topHeight+',width='+idialogWidth+',height='+idialogHeight);					
					break;				
			}								
		}	
	}
}

